#include<bits/stdc++.h>
#define int long long 
using namespace std;

const int maxn=1e3+10;
int n, d;
bitset<maxn> vis;
struct Pos{
	int seq;
	int x, y;
};
queue<Pos> q;
vector<Pos> v;
void solve(){
	cin>>n;
	for(int i=0;i<n;i++){
		int x,y;
		cin>>x>>y;
		v.push_back({i, x, y});
	}
	cin>>d;
	q.push({0, v[0].x, v[0].y});
	vis[0]=1;
	while(!q.empty()){
		Pos cur=q.front();
		q.pop();
		for(int i=0;i<v.size();i++){
			if(vis[i]){
				continue;
			}
			if((v[i].x-cur.x)*(v[i].x-cur.x)+(v[i].y-cur.y)*(v[i].y-cur.y)<=d*d){
				q.push({i, v[i].x, v[i].y});
				vis[i]=1;
			}
		}
	}
	
	for(int i=0;i<v.size();i++){
		cout<<vis[i]<<'\n';
	}
}


signed main(){
	ios::sync_with_stdio(0), cin.tie(0),cout.tie(0);
	solve();
	return 0;
}
